<template>
  <div class="weekly-report-management">
    <div v-if="device !== 'mobile'" class="pc">
      <pcIndex
        ref="pcIndex"
        :userList="userList"
        :projectList="projectList"
        :query="queryParams"
      ></pcIndex>
    </div>

    <div v-else class="mobile">
      <mobileIndex
        ref="mobileIndex"
        :projectList="projectList"
        :userList="userList"
        :query="queryParams"
      ></mobileIndex>
    </div>
  </div>
</template>

<script>
import { mapGetters } from "vuex";
import pcIndex from "./pc/index.vue";
import mobileIndex from "./mobile/collectPayMoneyMobile.vue";

import { getUserListByStatus } from "@/api/system/user";

import { getCrmProjectAllNoPage } from "@/api/crm/project";
export default {
  name: "WeeklyReportManagement",
  components: { pcIndex, mobileIndex },
  data() {
    return {
      userList: [],
      projectList: [],
      detailsName: {
        typeName: "收款类型",
        timeName: "预计收款时间",
        amountName: "预计收款金额",
        statusName: "收款状态",
      },
      queryParams: {},
    };
  },
  methods: {
    getUserListByStatus() {
      getUserListByStatus({ status: "0" }).then((res) => {
        this.userList = res.data;
      });
    },
    getCrmProjectAllNoPage() {
      getCrmProjectAllNoPage({}).then((res) => {
        this.projectList = res.data;
      });
    },
  },
  computed: {
    ...mapGetters(["device"]),
  },
  created() {
    this.queryParams = this.$route.query.queryParams
    this.getUserListByStatus();
    this.getCrmProjectAllNoPage();
  },
  watch: {
    device(newVal, oldVal) {
      this.$nextTick(() => {
        // if (this.device === "mobile") {
        //   this.queryParams.isGroupData = this.active === 'groupDetailsMoilb'
        //   this.$refs[this.active].getList();
        // } else {
        //   this.$refs[this.activeName].getList();
        // }
      });
    },
  },
};
</script>

<style scoped lang="scss">
</style>
